<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWorkOrderRejectDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('work_order_reject_details', function (Blueprint $table) {
            $table->id();
            $table->string('workOrderNo', 32)->default('')->comment('工单号');
            $table->unsignedInteger('rejectId')->default(0)->comment('work_order_rejects表id');
            $table->string('field', 64)->default('')->comment('字段名');
            $table->string('fieldText', 32)->default('')->comment('字段说明');
            $table->string('fieldValue', 255)->default('')->comment('字段值');
            $table->string('reasonOptionText', 32)->default('')->comment('驳回理由下拉内容');
            $table->string('reasonText', 255)->default('')->comment('驳回理由');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger('isDeleted')->default(0);
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '工单 - 驳回详情表';

            $table->index(['workOrderNo'], 'idx_workOrderNo');
            $table->index(['rejectId'], 'idx_rejectId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('work_order_reject_details');
    }
}
